package cn.itcast.test;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.locks.LockSupport;

import static cn.itcast.n2.util.Sleeper.sleep;

@Slf4j(topic = "c.ParkTest14")
public class ParkTest14 {

    public static void main(String[] args) throws InterruptedException {
        test3();
    }

    private static void test3() throws InterruptedException {
        Thread t1 = new Thread(() -> {
            log.debug("park...1");
            log.debug("打断状态：{}", Thread.currentThread().isInterrupted());
            LockSupport.park();
            log.debug("park...2");
            log.debug("打断状态：{}", Thread.interrupted());
            log.debug("park...3");
            LockSupport.park();
            log.debug("park...4");
        }, "t1");
        t1.start();

        sleep(3);
        t1.interrupt();

    }


}
